﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Web.Configuration;


namespace ConsultasLogopedia.Data.Data
{
    public abstract class GenericEntityFrameworkDao
    {
        private ManagerEntities _context = null;

        private String _connectionString = String.Empty;

        public ManagerEntities Context
        {
            get { return _context; }
        }


        public GenericEntityFrameworkDao()
        {
            //Get connectionString 

            if (_connectionString == String.Empty)
            {
                GetConnectionString();
            }
            _context = new ManagerEntities(_connectionString);
        }

        private void GetConnectionString()
        {
            if (WebConfigurationManager.ConnectionStrings["LogModel"] != null)
            {
                _connectionString = WebConfigurationManager.ConnectionStrings["LogModel"].ConnectionString;
            }           
        }   

    }
}
